package com.example.uiactivity;

import android.os.Bundle;
import android.app.Activity;
import android.view.KeyEvent;
import android.view.Menu;
import android.widget.Toast;

public class UIActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_ui);
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		switch (keyCode) {
		case KeyEvent.KEYCODE_DPAD_CENTER:
			Toast.makeText(getBaseContext(), "Center was clicked",
					Toast.LENGTH_LONG).show();
			break;
		case KeyEvent.KEYCODE_DPAD_LEFT:
			Toast.makeText(getBaseContext(), "Left arrow was clicked",
					Toast.LENGTH_LONG).show();
			break;
		case KeyEvent.KEYCODE_DPAD_RIGHT:
			Toast.makeText(getBaseContext(), "Right arrow was clicked",
					Toast.LENGTH_LONG).show();
			break;
		case KeyEvent.KEYCODE_DPAD_UP:
			Toast.makeText(getBaseContext(), "Up arrow was clicked",
					Toast.LENGTH_LONG).show();
			break;
		case KeyEvent.KEYCODE_DPAD_DOWN:
			Toast.makeText(getBaseContext(), "Down arrow was clicked",
					Toast.LENGTH_LONG).show();
			break;
		}
		return false;
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.ui, menu);
		return true;
	}

}
